package com.jzx.provider.cv.repository;

import com.jzx.provider.cv.model.CurrentInfo;
import com.jzx.provider.cv.model.ForwardInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * Created by chuzhaowi on 2019/12/21
 */
public interface ForwardInfoRepository extends JpaRepository<ForwardInfo, Integer> {
    /**
     * 根据简历id 查找期望状况
     *
     * @param cvId 简历id
     * @return 期望状况
     */
    ForwardInfo findByCvId(Long cvId);

    @Modifying
    @Query(nativeQuery = true, value = "update t_forward_info set vocations=:#{#forwardInfo.vocations}," +
            "titles=:#{#forwardInfo.titles},salary=:#{#forwardInfo.salary}," +
            "cities=:#{#forwardInfo.cities},update_time=:#{#forwardInfo.updateTime} where id=:#{#forwardInfo.id}")
    void updateCvForwardInfo(ForwardInfo forwardInfo);
}
